/*
 This program is submitted as part of an assignment in the
 J2E
 Fall Semester 2010-2011 
 School of Computer Science
 Interdisciplinary Center, Hertzelia, Israel 

 http://www.idc.ac.il 

 Exercise No.         : 1
 File Name            : Figure.java
 Names (First Last)   : Itay Sorani, Nadav Ziv, Yonathan Zarsky
 Student No.          : 066530254, 039937883, 039692918
 */

package com.example.util;

import android.content.Context;

/**
 * The Figure class. any game figure has to inherit from this class.
 * @param img the model bitmap.
 * @param xPosition the model x position.
 * @param yPosition the model y position.
 * @param modelId holds the model distinct id.
 */
public class Figure {
	
	private float xPosition;
	private float yPosition;
	private int modelId;
	private FigureType figureType = FigureType.general;
	private String name = "GeneralFigure";
	private int playerId = -1;
	// the current unit direction.
	private Vec2D direction;
	private float velocity;
	
	/*
	 *  GameModel constructor.
	 *  Receives the model's bitmap as an input.
	 *  sets the ball moving direction to 0,0.
	 */
	public Figure(Context context) {
	}
	
	public Figure() {
	}

	/*
	 *  sets the x position of the figure.
	 */
	public void setX (float x) {
		this.xPosition = x;
	}
	
	/*
	 *  sets the y position of the figure.
	 */
	public void setY (float y) {
		this.yPosition = y;
	}
	
	/*
	 *  sets the x,y position of the figure.
	 */
	public void setPosition (float x, float y) {
		this.xPosition = x;
		this.yPosition = y;
	}
	
	/*
	 *  returns the x position of the figure.
	 */
	public float getX() {
		return (this.xPosition);
	}
	
	/*
	 *  returns the y position of the figure.
	 */
	public float getY() {
		return (this.yPosition);
	}
		
	/*
	 *  moves the figure by a 2d vec.
	 */
	public void moveFigure (float x, float y) {
		this.xPosition += x;
		this.yPosition += y;
	}
	
	/*
	 *  returns the id of the figure.
	 */
	public int getId() {
		return (this.modelId);
	}
	
	/*
	 *  sets the id of the figure.
	 */
	public void setId (int id) {
		this.modelId = id;
	}
	
	/*
	 * returns the figure's position
	 */
	public Vec2D getPosition () {
		return (new Vec2D(this.xPosition,this.yPosition));
	}

	/*
	 * sets the figure's type
	 */
	public void setFigureType(FigureType figureType) {
		this.figureType = figureType;
	}
	
	/*
	 * gets the figure's type
	 */
	public FigureType getFigureType() {
		return figureType;
	}

	/*
	 * sets the figure name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/*
	 * gets the figure name
	 */
	public String getName() {
		return name;
	}

	/*
	 * sets the player id
	 */
	public void setPlayerId(int playerId) {
		this.playerId = playerId;
	}

	/*
	 * gets the player id
	 */
	public int getPlayerId() {
		return playerId;
	}
	
	/**
     * sets the current direction of the unit
     */
	public void setDirection(Vec2D direction) {
		this.direction = direction;
	}

	/**
     * returns the current direction of the unit
     */
	public Vec2D getDirection() {
		return direction;
	}

	public void setVelocity(float velocity) {
		this.velocity = velocity;
	}

	public float getVelocity() {
		return velocity;
	}
}
